import request from '@/config/axios'

export function useCourseApi() {
  return {
    // 分页
    getPage: async (params: any) => {
      return await request.get({url: '/yxt/course/page', params})
    },
    // 导出
    export: (params: any) => {
      return request.download({url: "/yxt/course/export", params});
    },
    teaCourseList: (data: any) => {
      return request.post({url: '/yxt/course/teaCourseList', data})
    },
    teaCourseListNoPage: async (data: any) => {
      return request.post({url: '/yxt/course/teaCourseListNoPage', data})
    },
    courseListForStu: (data: any) => {
      return request.post({url: '/yxt/course/courseListForStu', data})
    },
    memberListForTea: (params: any) => {
      return request.get({url: '/yxt/course/memberListForTea', params})
    },
    // 查询课程配置
    getConfig: () => {
      return request.get({url: '/yxt/course/config/get'})
    },
    // 更新课程配置
    updateConfig: (data: any) => {
      return request.post({url: '/yxt/course/config/update', data})
    },
  }
}

export function useCourseDetailApi() {
  return {
    // 分页
    getDetailPage: async (params: any) => {
      return await request.get({url: '/yxt/course/detail', params})
    },
    getList: async (data: any) => {
      return await request.post({url: '/yxt/course/stuCourseList', data})
    },
    getListNoPage: async (data: any) => {
      return await request.post({url: '/yxt/course/stuCourseListNoPage', data})
    }
  }
}
